package top.haijunit.navi.auth.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import top.haijunit.framework.validation.ValidChecks;

/**
 * 权限信息
 *
 * @author zhanghaijun
 * @date 2024/8/17 17:04
 */
@Data
@Accessors(chain = true)
@Schema(description = "权限枚举")
public class PermissionInfo {

    @Schema(description = "权限分组编码")
    @ExcelProperty(value = "权限分组编码")
    @NotBlank(message = "权限分组编码不能为空", groups = {ValidChecks.GroupEdit.class, ValidChecks.GroupAdd.class})
    private String groupCode;

    @Schema(description = "权限分组名称")
    @ExcelProperty(value = "权限分组名称")
    private String groupName;

    @Schema(description = "权限编码")
    @ExcelProperty(value = "权限编码")
    @NotBlank(message = "权限编码不能为空", groups = {ValidChecks.GroupEdit.class})
    @Length(min = 2, max = 64, message = "权限编码长度为2-64个字符", groups = {ValidChecks.GroupEdit.class})
    private String code;

    @Schema(description = "权限名称")
    @ExcelProperty(value = "权限名称")
    @NotBlank(message = "权限名称不能为空", groups = {ValidChecks.GroupEdit.class, ValidChecks.GroupAdd.class})
    @Length(min = 2, max = 64, message = "权限名称长度为2-64个字符", groups = {ValidChecks.GroupEdit.class, ValidChecks.GroupAdd.class})
    private String permissionName;

    @Schema(description = "权限优先级")
    @ExcelProperty(value = "权限优先级")
    @Min(value = 1, message = "权限优先级不能小于1", groups = {ValidChecks.GroupEdit.class, ValidChecks.GroupAdd.class})
    private Integer permissionLevel;

    @Schema(description = "权限描述信息")
    @ExcelProperty(value = "权限描述信息")
    @Length(max = 256, message = "权限描述信息长度不能超过256个字符", groups = {ValidChecks.GroupEdit.class, ValidChecks.GroupAdd.class})
    private String remarks;
}
